using System.Text;

namespace Microsoft.Services.TfsAlert.AppCode.NotificationEvents
{
    public partial class WorkItemChangedEvent : BaseNotificationEvent
    {
        public override string GetNotificationMessageTitle()
        {
            StringBuilder messageTitleBuilder = new StringBuilder();
            messageTitleBuilder.Append(this.ChangeType + " - Work Item");

            return messageTitleBuilder.ToString();
        }

        public override string GetNotificationMessage()
        {
            IntegerFieldCollection intFieldCollection = CoreFields.IntegerFields.FieldCollection;
            StringFieldCollection stringFieldCollection = CoreFields.StringFields.FieldCollection;

            StringBuilder stringMessageBuilder = new StringBuilder();
            stringMessageBuilder.AppendLine("ID: " + intFieldCollection[0].NewValue + " - " + this.WorkItemTitle);
            stringMessageBuilder.AppendLine("Work Item Type - " + stringFieldCollection[0].NewValue);
            stringMessageBuilder.AppendLine("State: " + stringFieldCollection[3].NewValue);
            stringMessageBuilder.AppendLine("Reason: " + stringFieldCollection[4].NewValue);
            stringMessageBuilder.Append("Changed By: " + stringFieldCollection[6].NewValue);

            return stringMessageBuilder.ToString();
        }
    }
}